/**
 * 本地存储并能远程读取
 */
Ext.ns('Microblogging.data');
Microblogging.data.ToggleNLStore = Ext.extend(Ext.data.Store, {
			constructor : function(cfg) {
				var config = {
					localProxy : Ext.data.ProxyMgr.create({
								type : 'localstorage',
								id : cfg.localProxyId
							}),
					networkProxy : Ext.data.ProxyMgr.create({
								type : 'proxy'
							}),
					loadLocalData : function(arg) {
						this.openLocalProxy();
						var me = this;
						this.load({
									scope : arg.scope,
									callback : function() {
										if (arg.callBack) {
											arg.callBack.apply(arg.scope
															|| this, arguments);
										}
										me.proxy = me.networkProxy;
									}
								});
					},
					syncLocalData : function() {
						this.openLocalProxy();
						this.sync();
						this.proxy = this.networkProxy;
					},
					openLocalProxy : function() {
						this.setProxy(this.localProxy);
					},
					listeners : {
						load : function() {
							this.syncLocalData();
						}
					}
				};
				Ext.apply(cfg, config, {
							proxy : config.networkProxy
						});
				Microblogging.data.ToggleNLStore.superclass.constructor
						.call(this,cfg)
			}
		});